package com.wman.learn.funcation

/**
 * @ProjectName: wman
 * @Package: com.wman
 * @ClassName: Test
 * @Description: Lambda闭包
 * @Author: wman
 * @CreateDate: 2019/11/13 15:04
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/11/13 15:04
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */

/**
 * 最多22个参数，如果想要更多的参数的话，需要手动的添加更多的接口
 */
var Kotlin07Print = { str: String ->
    println(str)
}

var Kotlin07Lambda23 = { str1: String, str2: String, str3: String, str4: String, str5: String, str6: String,
                         str11: String, str21: String, str31: String, str41: String, str51: String, str61: String,
                         str12: String, str22: String, str32: String, str42: String, str52: String, str62: String,
                         str13: String, str23: String, str33: String, str43: String, str53: String, str63: String ->
    println(str1)
}

/**
 * Lambda闭包
 */
fun main(args: Array<String>) {
    //Lambda表达式
    var thread = Thread {}
    thread = Thread()
    thread = Thread({})
    thread = Thread() {}
    thread.start()

    Kotlin07Print("wman")
    Kotlin07Lambda23("wman", "wman", "wman", "wman", "wman", "wman",
            "wman", "wman", "wman", "wman", "wman", "wman",
            "wman", "wman", "wman", "wman", "wman", "wman",
            "wman", "wman", "wman", "wman", "wman", "wman")
}

